package com.struct.graph.create_role
{
	import com.component.Component;
	import com.component.ComponentChildren;
	import com.component.button.Button;
	import com.component.button.ButtonSkin;
	import com.component.button.GraphButtonSkin;
	import com.component.button.VerticalButtonSkin;
	import com.component.scroll.GraphVScrollBar;
	import com.component.scroll.ScrollComponent;
	import com.component.scroll.SkinHScrollBar;
	import com.component.scroll.SkinVScrollBar;
	import com.utils.Utils;
	
	import flash.display.BitmapData;
	import flash.geom.Point;
	import flash.geom.Rectangle;
	import flash.text.TextField;
	import flash.utils.Dictionary;
	
	public class CreateRoleFrame extends Component
	{
		private var roleContainer:Component;
		private var scrollComponent:ScrollComponent;//滚动条
		public var txtName:TextField;//用户昵称
		public var btnSubmit:Button;//提交
		public function CreateRoleFrame()
		{
			super();
			createChildren();
		}
		private function createChildren():void{
			roleContainer = new Component();
			var skin:GraphVScrollBar = new GraphVScrollBar(16, 16, 16, 300);
			scrollComponent = new ScrollComponent(skin, 498, 300);
			scrollComponent.addContainer(roleContainer);
			addChild(scrollComponent);
			
			txtName = Utils.creatBorderTextField(this, 150, 320, 198);
			btnSubmit = new Button("提交");
			btnSubmit.x = 189;
			btnSubmit.y = 350;
			addChild(btnSubmit);
			
			x = (SSA.application.width - width) / 2;
			y = (SSA.application.height - height) / 2;
		}
		
		public function setValue(dict:Dictionary):void{
			//每行7个 间距10
			var i:uint = 0;
			var j:uint = 0;
			var rs:CreateRoleShow;
			for(var name:String in dict){
				if(name.indexOf('a') == -1){
					continue;
				}
				var roleSource:BitmapData = dict[name];
				rs = new CreateRoleShow(name, roleSource, this);
				roleContainer.addChild(rs);
				rs.x = i * (rs.width + 10);
				rs.y = j * (rs.height + 10);
				if(i++ > 7){
					i = 0;
					j++;
				}
			}
			scrollComponent.update();
		}
	}
}